
import lk.asha.desktop.beans.NewHibernateUtil;
import java.sql.Date;
import lk.asha.desktop.database.Sms;
import lk.asha.desktop.database.User;
import lk.asha.desktop.database.Userlog;
import org.hibernate.HibernateException;
import org.hibernate.Session;

public class NewClass {
    public static void main(String ee[]){

     try {
        Session session = NewHibernateUtil.getSessionFactory().openSession();

        User user=(User)session.load(User.class,1);
        Userlog obj =new Userlog(user,new java.util.Date());

        session.beginTransaction();
        session.save(obj);
        session.getTransaction().commit();

       } catch (HibernateException he) {
        he.printStackTrace();
       }

}
}